import React, {useEffect, useState} from 'react';

export default () => {
  const [count, setCount] = useState({number:0});

  /** 你会发现每次点击,这里的effect都会触发*/
  useEffect(() => {
    console.log('trigger effect')
  }, [/*count*//** ← 是浅比较 × */ count.number/** ← 是全等比较*/]);

  console.log('render');

  return (
    <div>
      <p>{count.number}</p>
      <button onClick={()=>setCount({number:1})}>button</button>
    </div>
  )
};
